
strstr2.o:     file format elf32-littlearm


Disassembly of section .text:

00000000 <sub_string>:
#include <string.h>
#include <stdio.h>

char * sub_string(unsigned char * des, unsigned char * src, unsigned int len)
{
   0:	e52db004 	push	{fp}		; (str fp, [sp, #-4]!)
   4:	e28db000 	add	fp, sp, #0
   8:	e24dd01c 	sub	sp, sp, #28
   c:	e50b0010 	str	r0, [fp, #-16]
  10:	e50b1014 	str	r1, [fp, #-20]	; 0xffffffec
  14:	e50b2018 	str	r2, [fp, #-24]	; 0xffffffe8
	char *tmp = des;
  18:	e51b3010 	ldr	r3, [fp, #-16]
  1c:	e50b3008 	str	r3, [fp, #-8]

	while(len > 0 && len--) {
  20:	ea000007 	b	44 <sub_string+0x44>
		*des++ = *src++;
  24:	e51b3010 	ldr	r3, [fp, #-16]
  28:	e2832001 	add	r2, r3, #1
  2c:	e50b2010 	str	r2, [fp, #-16]
  30:	e51b2014 	ldr	r2, [fp, #-20]	; 0xffffffec
  34:	e2821001 	add	r1, r2, #1
  38:	e50b1014 	str	r1, [fp, #-20]	; 0xffffffec
  3c:	e5d22000 	ldrb	r2, [r2]
  40:	e5c32000 	strb	r2, [r3]

char * sub_string(unsigned char * des, unsigned char * src, unsigned int len)
{
	char *tmp = des;

	while(len > 0 && len--) {
  44:	e51b3018 	ldr	r3, [fp, #-24]	; 0xffffffe8
  48:	e3530000 	cmp	r3, #0
  4c:	0a000004 	beq	64 <sub_string+0x64>
  50:	e51b3018 	ldr	r3, [fp, #-24]	; 0xffffffe8
  54:	e2432001 	sub	r2, r3, #1
  58:	e50b2018 	str	r2, [fp, #-24]	; 0xffffffe8
  5c:	e3530000 	cmp	r3, #0
  60:	1affffef 	bne	24 <sub_string+0x24>
		*des++ = *src++;
	}

	return tmp;
  64:	e51b3008 	ldr	r3, [fp, #-8]
}
  68:	e1a00003 	mov	r0, r3
  6c:	e24bd000 	sub	sp, fp, #0
  70:	e49db004 	pop	{fp}		; (ldr fp, [sp], #4)
  74:	e12fff1e 	bx	lr

00000078 <main>:


int main()
{
  78:	e92d4800 	push	{fp, lr}
  7c:	e28db004 	add	fp, sp, #4
  80:	e24dd040 	sub	sp, sp, #64	; 0x40
	char *haystack = "aaa||bbb||ccc||eee";
  84:	e59f312c 	ldr	r3, [pc, #300]	; 1b8 <main+0x140>
  88:	e50b3008 	str	r3, [fp, #-8]
	char *needle = "||";
  8c:	e59f3128 	ldr	r3, [pc, #296]	; 1bc <main+0x144>
  90:	e50b3010 	str	r3, [fp, #-16]
	char *buf = strstr( haystack, needle);
  94:	e51b1010 	ldr	r1, [fp, #-16]
  98:	e51b0008 	ldr	r0, [fp, #-8]
  9c:	ebfffffe 	bl	0 <strstr>
  a0:	e50b000c 	str	r0, [fp, #-12]
	char ch[10] = "1";
  a4:	e3a03031 	mov	r3, #49	; 0x31
  a8:	e50b3020 	str	r3, [fp, #-32]	; 0xffffffe0
  ac:	e3a03000 	mov	r3, #0
  b0:	e50b301c 	str	r3, [fp, #-28]	; 0xffffffe4
  b4:	e3a03000 	mov	r3, #0
  b8:	e14b31b8 	strh	r3, [fp, #-24]	; 0xffffffe8
	char *p;

	char dddd[30] = "xiaozhiwise";
  bc:	e59f20fc 	ldr	r2, [pc, #252]	; 1c0 <main+0x148>
  c0:	e24b3040 	sub	r3, fp, #64	; 0x40
  c4:	e8920007 	ldm	r2, {r0, r1, r2}
  c8:	e8830007 	stm	r3, {r0, r1, r2}
  cc:	e24b3034 	sub	r3, fp, #52	; 0x34
  d0:	e3a02000 	mov	r2, #0
  d4:	e5832000 	str	r2, [r3]
  d8:	e2833004 	add	r3, r3, #4
  dc:	e3a02000 	mov	r2, #0
  e0:	e5832000 	str	r2, [r3]
  e4:	e2833004 	add	r3, r3, #4
  e8:	e3a02000 	mov	r2, #0
  ec:	e5832000 	str	r2, [r3]
  f0:	e2833004 	add	r3, r3, #4
  f4:	e3a02000 	mov	r2, #0
  f8:	e5832000 	str	r2, [r3]
  fc:	e2833004 	add	r3, r3, #4
 100:	e3a02000 	mov	r2, #0
 104:	e1c320b0 	strh	r2, [r3]
 108:	e2833002 	add	r3, r3, #2

	while( buf != NULL )
 10c:	ea00000c 	b	144 <main+0xcc>
	{
		printf( "%s\n ", haystack);
 110:	e51b1008 	ldr	r1, [fp, #-8]
 114:	e59f00a8 	ldr	r0, [pc, #168]	; 1c4 <main+0x14c>
 118:	ebfffffe 	bl	0 <printf>
		haystack = buf + strlen(needle);
 11c:	e51b0010 	ldr	r0, [fp, #-16]
 120:	ebfffffe 	bl	0 <strlen>
 124:	e1a02000 	mov	r2, r0
 128:	e51b300c 	ldr	r3, [fp, #-12]
 12c:	e0833002 	add	r3, r3, r2
 130:	e50b3008 	str	r3, [fp, #-8]
		/* Get next token: */
		buf = strstr( haystack, needle);
 134:	e51b1010 	ldr	r1, [fp, #-16]
 138:	e51b0008 	ldr	r0, [fp, #-8]
 13c:	ebfffffe 	bl	0 <strstr>
 140:	e50b000c 	str	r0, [fp, #-12]
	char ch[10] = "1";
	char *p;

	char dddd[30] = "xiaozhiwise";

	while( buf != NULL )
 144:	e51b300c 	ldr	r3, [fp, #-12]
 148:	e3530000 	cmp	r3, #0
 14c:	1affffef 	bne	110 <main+0x98>
		haystack = buf + strlen(needle);
		/* Get next token: */
		buf = strstr( haystack, needle);
	}

	printf("%d\n", atoi(ch));
 150:	e24b3020 	sub	r3, fp, #32
 154:	e1a00003 	mov	r0, r3
 158:	ebfffffe 	bl	0 <atoi>
 15c:	e1a03000 	mov	r3, r0
 160:	e1a01003 	mov	r1, r3
 164:	e59f005c 	ldr	r0, [pc, #92]	; 1c8 <main+0x150>
 168:	ebfffffe 	bl	0 <printf>

	p = sub_string(ch, dddd+4, 4);
 16c:	e24b3040 	sub	r3, fp, #64	; 0x40
 170:	e2831004 	add	r1, r3, #4
 174:	e24b3020 	sub	r3, fp, #32
 178:	e3a02004 	mov	r2, #4
 17c:	e1a00003 	mov	r0, r3
 180:	ebfffffe 	bl	0 <sub_string>
 184:	e50b0014 	str	r0, [fp, #-20]	; 0xffffffec
	printf("%s\n", p);
 188:	e51b0014 	ldr	r0, [fp, #-20]	; 0xffffffec
 18c:	ebfffffe 	bl	0 <puts>

	printf("%ld\n", strlen("xia\0as22"));
 190:	e3a01003 	mov	r1, #3
 194:	e59f0030 	ldr	r0, [pc, #48]	; 1cc <main+0x154>
 198:	ebfffffe 	bl	0 <printf>
	printf("%d\n", '9' - '0');
 19c:	e3a01009 	mov	r1, #9
 1a0:	e59f0020 	ldr	r0, [pc, #32]	; 1c8 <main+0x150>
 1a4:	ebfffffe 	bl	0 <printf>

	return 0;
 1a8:	e3a03000 	mov	r3, #0
}
 1ac:	e1a00003 	mov	r0, r3
 1b0:	e24bd004 	sub	sp, fp, #4
 1b4:	e8bd8800 	pop	{fp, pc}
 1b8:	00000000 	.word	0x00000000
 1bc:	00000014 	.word	0x00000014
 1c0:	0000002c 	.word	0x0000002c
 1c4:	00000018 	.word	0x00000018
 1c8:	00000020 	.word	0x00000020
 1cc:	00000024 	.word	0x00000024
